﻿@using mscook.mvc;
@model mscook.mvc.Models.MagazineInnerModel
@{
    ViewBag.Title = "杂志";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section JavaScript
{
    <script src="@Url.Content("~/BootStrap/js/jquery-ui.min.js")"></script>
    <script src="@Url.Content("~/Carousel/allinone_thumbnailsBanner.js")"></script>
    <script src="@Url.Content("~/Carousel/jquery.featureCarousel.js")"></script>
    <script type="text/javascript">

        $(function () {
            var $w = $(window);
            var $scr_wid = $(window).width();
            var $w_height = $w.height();
            var acc_min_width;//accordion
            var feature_width, feature_height, feature_pad_side;//3DfeatureCarousel

            function menu_cheak(selector, classname) {
                var $select = selector;
                $select.click(function () {
                    $(this).addClass(classname).siblings().removeClass(classname);

                })

            }
            menu_cheak($('.nav li'), 'active');
            menu_cheak($('.recipes .recipes_menu .menu_main dl dd a'), 'chosed');
            function accordion_menu(selector, operated, classname) {
                var $select = selector;
                $select.click(function () {

                    $(this).parent().toggleClass(operated);
                    $(this).next(classname).slideToggle(300);
                })

            }
            accordion_menu($('.recipes .recipes_menu .menu_main dl dt'), 'on', 'dd');



            (function () {
                $('body').animate({ scrollTop: $('.navbar').offset().top }, 1000);
            })();//友好的页面显示，全局作用



            $.getJSON("@Url.Content("~/Home/SelectImageSetting")", function (config) {
                var folder;
                var banner_wid;
                var banner_hei;
                var screen_num;
                function hasFolder(set, folder) {
                    var image_setting = null;
                    $.each(set, function (i, elem) {
                        if (elem.folder == folder) {
                            image_setting = elem;
                            return false;
                        }
                    });
                    return image_setting;
                }
                $.each(config, function (i, item) {
                    //alert(config[i].name);
                    var images = config[i].ImageSettings;
                    //alert(images.folder);
                    //var img_fol = images.folder;
                    if (images != null && images.length != 0) {
                        var image_setting;
                        if ($scr_wid >= 1200 && (image_setting = hasFolder(images, "wide")) !== null) {
                            folder = "wide";
                            acc_min_width = "115px";
                            banner_wid = image_setting.width;
                            banner_hei = image_setting.height;
                            screen_num = 7;
                            //feature_width = 450;
                            //feature_height = 230;

                        } else if ($scr_wid >= 768 && $scr_wid <= 979 && (image_setting = hasFolder(images, "pad")) !== null) {
                            folder = "pad";
                            acc_min_width = "30px";
                            banner_wid = image_setting.width;
                            banner_hei = image_setting.height;
                            screen_num = 5;
                            //feature_width = 340;
                            //feature_height = 174;


                        } else if ($scr_wid < 768 && (image_setting = hasFolder(images, "mobile")) !== null) {
                            folder = "mobile";
                            acc_min_width = "20px";
                            banner_wid = image_setting.width;
                            banner_hei = image_setting.height;
                            screen_num = 7;


                        } else {
                            image_setting = hasFolder(images, "default");
                            folder = "default";
                            acc_min_width = "70px";
                            banner_wid = image_setting.width;
                            banner_hei = image_setting.height;
                            screen_num = 7;
                            //feature_width = 450;
                            //feature_height = 230;
                        }
                        $('div[data-image-setting=' + config[i].alias + '] img').each(function (i, img) {
                            var $img = $(img);

                            var $slide_li = $img.parent();
                            var source = $img.data("source");
                            if (source) {
                                var data = "@Url.Content("~/Upload/")" + folder + "/" + source;
                                 if (data) {
                                     $img.attr("data-src", data);
                                     $slide_li.attr("data-bottom-thumb", data);
                                 }
                             }
                             $img.unveil();


                         });




                     }

                 })

            });

        });

    </script>
}
<div class="container ">
    <div class="row">
        <div class="magazine_inner clearfix">
            <div class="span4" data-image-setting="Magazine">
                <a>
                    <img src="lazyload/grey.gif" data-source="@Model.Magazine.ImageName" /></a>
            </div>
            <div class="span8 inner_detail">
                <h3 class="inner_title">@Html.Encode("《美食之窗》" + Model.Magazine.Year + "年第" + Model.Magazine.Volume + "月刊")</h3>
                <ul>
                    <li>简介：@Html.Encode(Model.Magazine.Title)</li>
                    <li>阅读：@Html.Encode(Model.Magazine.ReadTimes)</li>
                    <li>更新：@Html.Encode(Model.Magazine.CreateTime.Date)</li>
                </ul>

                <div class="row til_list">
                    <div class="span3">
                        <h4>可读文章</h4>
                        <ul>
                            <li>全部</li>
                        </ul>
                    </div>

                    <div class="span3">
                        <h4>全部文章</h4>
                        <ul>
                            @for (int i = 0; i < Model.ArticlePublishDetails.Count; i++)
                            {
                                var item = Model.ArticlePublishDetails.ElementAt(i);
                                <li><a href="@Url.Action("ReadArticle", new { year = Model.Magazine.Year, month = Model.Magazine.Volume, id = Model.Magazine.Id })">@Html.Encode(item.DataOfUnit.title)</a></li>
                                     
                                if (i == 10)
                                {
                                @Html.Raw("<li>..</li>")
                                    break;
                                }

                            }
                        </ul>
                    </div>
                </div>
                <div class="inner_but row">
                    <a class="btn span2" href="@Url.Action("ReadArticle", new { year = Model.Magazine.Year, month = Model.Magazine.Volume, id = Model.Magazine.Id })">在线阅读</a>
                    <a class="btn span2">积分充值</a>
                </div>
            </div>
        </div>
    </div>
</div>
